package com.neusoft.work.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.work.dto.CareRecordDTO;
import com.neusoft.work.po.CareRecord;
import com.neusoft.work.po.PageResponseBean;
import com.neusoft.work.po.ResponseBean;
import com.neusoft.work.service.CareRecordService;


@RequestMapping("/CareRecordController")
@RestController
public class CareRecordController {

	@Autowired
	private CareRecordService crs;
	
	@RequestMapping("/queryByCustomerId")
	public PageResponseBean<List<CareRecordDTO>> queryByCustomerId(Integer customerId, Long cur, Long number, String start, String end){
		return crs.queryByCustomerId(customerId, cur, number, start, end);
	}
	
	@RequestMapping("/deleteCareRecord")
	public ResponseBean<Integer> deleteCareRecord(Integer id){
		return crs.deleteCareRecord(id);
	}
	
	@RequestMapping("/addCareRecord")
	public ResponseBean<Integer> addCareRecord(CareRecord careRecord){
		return crs.addCareRecord(careRecord);
	}
	
    @GetMapping("/byStaff")
    public ResponseBean<List<CareRecord>> getByStaff(@RequestParam Integer staffId) {
        List<CareRecord> list = crs.listByCareStaffId(staffId);
        return new ResponseBean<>(list);
    }
	
}
